package base;

import java.util.List;

public class FindUtils {


    /***
     * 找到最年轻的党员
     * @param classList
     */
    public static Human01 findYongestOne(List<Human01> classList) {
        if(classList == null) {
            return null;
        }
        if(classList.size() == 0) {
            return null;
        }

        Human01 result = null;
        for (Human01 human01 : classList) {
            if(human01.isIstrue()) {
                if(result == null) {
                    result = human01;
                } else {
                    int currentAge = human01.getAge();
                    int historyAge = result.getAge();
                    if(currentAge < historyAge) {
                        result = human01;
                    }
                }
            }
        }

        return result;
    }

}
